package com.windy.service.impl;

import org.hibernate.SessionFactory;
import org.springframework.transaction.annotation.Transactional;

import com.windy.dao.account.UserDAO;
import com.windy.domain.account.User;
import com.windy.service.BaseService;
import com.windy.service.interfaces.IAccountService;

public class AccountServiceImpl extends BaseService implements IAccountService {
	public AccountServiceImpl(Object sessionFactory) {
		super.setSessionFactory(sessionFactory);
	}

	private UserDAO getUserDAO() {
		UserDAO dao = new UserDAO();
		dao.setSessionFactory((SessionFactory) this.getSessionFactory());
		return dao;
	}

	//@Transactional(readOnly = false)
	public void createUser(User domain) {
		this.getUserDAO().saveOrUpdate(domain);
	}

	public User findUserByLoginName(String loginName) {
		return this.getUserDAO().findUserByLoginName(loginName);
	}
	
	
}
